Skip to main content

googleSignIn

Type

handler

Summary

Initiate the Google Sign-In process

Syntax

googleSignIn(<pOptions>)

Description

Use the googleSignIn handler to start the Google Sign-In flow on Android, giving access to details about the signed-in user according to the options specified. If an account has been previously authenticated then this handler returns immediately; otherwise an authentication dialog is presented to the user.

Once the sign-in attempt is complete, the googleSignInResponse message is sent to the object that called googleSignIn, with a parameter indicating whether sign-in was successful.

Parameters

NameTypeDescription

pOptions

The options used to configure Google Sign-In. pOptions is an optional array, and the presence of a key results in that option being used in the configuration. The following keys are allowed:

  • "server-client-id": Specifies the client ID of the backend server. This must be present if you need to request an ID token for the authenticated user.
  • "require-offline-access": Specifies that offline access is requested. Requesting offline access requires that the server client ID be specified.
  • "require-email": Specifies that the user's email address is requested by your application.
  • "account-name": Specifies an account name on the device that should be used. If this is not present, the client will use the current default account for this application.
  • "hosted-domain": Specifies a hosted domain restriction. By setting this, sign-in will be restricted to accounts of the user in the specified domain.

Regardless of the options specified, the user's display name, given name, family name, id and photo url are always accessible once signed in.

Examples

local tOptionsA
put true into tOptionsA["require-email"]
return googleSignIn(tOptionsA)

Value

NameTypeDescription

return

The googleSignIn handler returns a string describing any error, or empty if none occurred.

handler: googleSignInRequired, googleSignOut

message: googleSignInResponse

Compatibility and Support

OS

android